package cn.lynu.study.practice12_7;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class URLDownload {

	public static void main(String[] args) throws IOException {
		URL url = new URL("http://www.lynu.edu.cn");

		BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
		BufferedWriter bw = new BufferedWriter(new FileWriter("zmd.html"));

		String line = null;
		while ((line = br.readLine()) != null) {
			bw.write(line + "\n");
		}
		Runtime.getRuntime().exec("zmd.html");
		br.close();
	}
}
